Component({
  data: {
    active: 0,
    list: [
      {
        text: '首页',
        url: '/pages/home/home'
      },
      {
        text: '发布',
        url: '/pages/publish/publish'
      },
      {
        text: '消息',
        url: '/pages/message/message'
      },
      {
        text: '我的',
        url: '/pages/user/user'
      }
    ]
  },

  methods: {
    onChange(event) {
      const index = event.detail
      const url = this.data.list[index].url
      wx.switchTab({ url })
      this.setData({ active: index })
    }
  }
}) 